package com.itfreer.forestry.manage.token.common;

import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;

@Configuration
public class MinglingUrl {

	@Value("${mingling.inter.baseUrl}")
	public static String baseUrl;
	@Value("${mingling.inter.appKey}")
	public static String AppKey;
	@Value("${mingling.inter.appSecret}")
	public static String AppSecret;

	public static String UserPass;

	@Value("${mingling.inter.publicKey}")
	public static String publicKey;

	public static String token;

	/**
	 * 公钥获取接口
	 */
	public static String PublicKeyUrl = "/api/admin/sysUser/common/getPublicKey";
	/**
	 * token获取
	 */
	public static String TokenUrl = "/api/openapi/oauth/userlogin";
	/**
	 * Token认证
	 */
	public static String CheckTokenUrl = "/api/admin/sysUser/validateToken";
	/**
	 * 退出登录
	 */
	public static String LoginOutUrl = "/api/admin/sysUser/logout";
	/**
	 * 单位列表
	 */
	public static String OfficeUrl = "/api/admin/oAuth2/sysOffice/officePage";
	/**
	 * 用户列表
	 */
	public static String UserUrl = "/api/admin/oAuth2/sysUser/userPage";


	public static String getBaseUrl() {
		return baseUrl;
	}

	@Value("${mingling.inter.baseUrl}")
	public void setBaseUrl(String baseUrl) {
		MinglingUrl.baseUrl = baseUrl;
	}

	@Value("${mingling.inter.appKey}")
	public void setAppKey(String appKey) {
		MinglingUrl.AppKey = appKey;
	}

	@Value("${mingling.inter.appSecret}")
	public void setAppSecret(String appSecret) {
		MinglingUrl.AppSecret = appSecret;
	}

	@Value("${mingling.inter.userpass}")
	public void setUserPass(String userpass) {
		MinglingUrl.UserPass = userpass;// 9f51739ae98909bf34c102b8a3fd5a040c42d832
	}

	public static String getUserPass() {
		return UserPass;
	}

	public static String getPublicKeyUrl() {
		return baseUrl + PublicKeyUrl;
	}

	public static String getTokenUrl() {
		return baseUrl + TokenUrl;
	}

	public static String getCheckTokenUrl() {
		return baseUrl + CheckTokenUrl;
	}

	public static String getLoginOutUrl() {
		return baseUrl + LoginOutUrl;
	}

	public static String getOfficeUrl() {
		return baseUrl + OfficeUrl;
	}

	public static String getUserUrl() {
		return baseUrl + UserUrl;
	}

	public static String getPublicKey() {
		return publicKey;
	}

	public static void setPublicKey(String publicKey) {
		MinglingUrl.publicKey = publicKey;
	}

	public static String getToken() {
/*		if (token == null){
			DockTokenInter.initToken();
		}*/

		return token;
	}

	public static void setToken(String token) {
		MinglingUrl.token = token;
	}
}
